<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>5.关于数组的filter方法</title>
  </head>
  <body>
    <script type="text/javascript" >
      let arr1 = [1,3,5,7,9]
      let arr2 = [
        {name:'张三',age:13},
        {name:'李四',age:16},
        {name:'王五',age:18},
        {name:'赵六',age:34},
      ]

      const x = arr1.filter((item)=>{
        return item > 5
      })
      console.log(x)

      const y = arr2.filter( item => item.age >= 18)
      console.log(y)

      // 1.是否改变原数组
      // 2.写不写返回值
      // 3.有没有返回值

      const z = arr1.forEach((item)=>{
        console.log(item)
        return 666
      })
      console.log(z)

    </script>
  </body>
</html>